//
//  UserInfoNetWorking.m
//  心水宝典
//
//  Created by zr on 2018/9/3.
//  Copyright © 2018年 zr. All rights reserved.
//

#import "UserInfoNetWorking.h"

@implementation UserInfoNetWorking


+(instancetype)sharedTools{
    
    static UserInfoNetWorking *instance;
    static dispatch_once_t onceToken;
    NSString * token = DEF_GET_OBJECT(@"token");
    dispatch_once(&onceToken, ^{
        //基本的地址
        NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
        
        NSURL *url = [NSURL URLWithString:BASEURLSTR];
        
        instance = [[UserInfoNetWorking alloc] initWithBaseURL:url sessionConfiguration:config];
        
        //设置超时时间
        config.timeoutIntervalForRequest = 10;
        
        instance.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html", @"image/jpeg",@"image/png", @"application/octet-stream", nil];
        instance.requestSerializer = [AFHTTPRequestSerializer serializer];
        [instance.requestSerializer setValue:token forHTTPHeaderField:@"accesstoken"];
        
    });
    
    return instance;
}

@end
